package com.jiuxian.example2;

import java.util.Objects;

public class HeaderHandler implements Handler {

    private Integer header;

    public HeaderHandler(Integer header) {
        this.header = header;
    }

    @Override
    public void doHandler(RequestSource requestSource, HandlerChain handlerChain) {
        if (Objects.equals(header, requestSource.getHeader())) {//是我的责任范围
            Integer header = requestSource.getHeader();
            System.out.println("header handler = " + header);
        }
        //继续下一个 你可以根据条件来决定是否继续进行chain
        handlerChain.doChain(requestSource);
    }
}
